package com.test.springboot_test.stringTest;

public class StringTest5 {

    public static void main(String[] args) {

        /**
         * 字符串的基本操作
         * 1.字符串的截取
         * 2.字符串的拼接
         * 3.字符串的索引，匹配从前往后
         * 4.字符串的索引，匹配从后往前
         * 5.字母从大到小，字符串切换
         * 6.字母从小到大，字符串切换
         */
        //1.字符串的拼接
        StringBuilder builder = new StringBuilder();
        String a []={"1","2","3"};
        for(String aStr : a){
            builder.append(aStr);
        }
        System.out.println(builder.toString());

        //2.字符串的截取和字符串的索引
        String str = "1+1=@2";
        System.out.println(str.substring(0, str.lastIndexOf("@")));
        System.out.println(str.substring(str.lastIndexOf("@") + 1));
        //3.小写字母转换为大写字母
        String str2 = "abcdefg";
        System.out.println(str2.toUpperCase());

    }

}
